home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / feel0_89.lha / Feel / Modules / copy.em < prev    next >
Text File  |  1993-07-15  |  719b  |  42 lines

  1. ;; Eulisp Module
  2. ;; Author: pab
  3. ;; File: copy.em
  4. ;; Date: Tue Jun 29 22:43:51 1993
  5. ;;
  6. ;; Project:
  7. ;; Description: 
  8. ;;   Copy module.
  9. ;;   Defines default behaviour for copy.
  10. ;;   Sequences handled separately
  11.  
  12.  
  13. (defmodule copy
  14.   (extras0
  15.    init
  16.    macros0
  17.    defs
  18.    gens
  19.    )
  20.   ()
  21.   
  22.   (export copy deep-copy shallow-copy)
  23.  
  24.   (defmethod deep-copy ((x <object>))
  25.     (shallow-copy x))
  26.  
  27.   (defmethod shallow-copy ((x <object>))
  28.     x)
  29.   
  30.   (defmethod deep-copy ((s <structure>))
  31.     (let ((r (make (class-of s))))
  32.       (do
  33.       (lambda (sd)
  34.         ((slot-description-slot-writer sd)
  35.          r
  36.          (deep-copy ((slot-description-slot-reader sd) s))))
  37.       (class-slot-descriptions (class-of s)))
  38.       r))
  39.  
  40.   ;; end module
  41.   )
  42.